<?php
/**
 * Image report library
 *
 * This library takes each properties ml number
 * and outputs all property photos to screen.
 * @package Reports
 */

/**
 *
 */
require_once(AD_SERVER_PATH . '/pkgs/init.php');
require_once(AD_SERVER_PATH . '/pkgs/utils.php');
require_once(AD_SERVER_PATH . '/reports/report.php');

/**
 * Image report library
 *
 * This library takes each properties ml number
 * and outputs all property photos to screen.
 * @package Reporting
 */
class CIMG_report extends CReport
{
	/**
	 * Outputs all images available for each property
	 *
	 * This method takes each properties ml number
	 * and outputs all property photos to screen.
	 */
	public function get_report()
	{
		$xml = simplexml_load_string($this->get_data());

		$output = '<html><body>';
		foreach ($xml->rows->row AS $row)
		{
			$imgs = CUtils::mk_tmp_img($row->ml_number, '*');

			$output .= '<div>';
			$output .= '<br />';
			$output .= '<span> ' . $this->get_address($row) . ' </span>';
			$output .= '<span style="position: absolute; right: 10"> ' . ' MLS: ' . $row->ml_number . ' </span>';
			$output .= '<br />';
			$output .= '<hr>';

			foreach($imgs AS $img)
			{
				$output .= '<img src="' . str_replace(AD_SERVER_PATH . '/', '', $img) . '" width="200" height="150" />&nbsp;';
			}

			$output .= '</div>';
			$output .= '<br /><br /><br />';
		}
		$output .= '</body></html>';

		echo $output;
	}
}
